package com.ease.map.events {
   import com.ease.map.Map;
   import com.ease.map.geometry.basetype.Location;

   import flash.events.Event;
   import com.ease.map.events.EventBase;

   /**
    * 地图事件
    */
   public class MapEvent extends EventBase {
      private var _map:Map = null;

      /**old放大等级*/
      private var _oldZoom:Number = 0;
      /**new放大等级*/
      private var _newZoom:Number = 0;
      /**old中心点*/
      private var _oldCenter:Location = null;
      /**新中心点*/
      private var _newCenter:Location = null;

      /**拖动开始，只是移动laycontainer*/
      public static const DRAG_START:String = "pkmap.mapdragstart";
      /**移动开始，开始从新加载当前屏幕的数据*/
      public static const MOVE_START:String = "pkmap.mapmovestart";
      /**移动结束*/
      public static const MOVE_END:String = "pkmap.mapmoveend";
      /**map窗口大小改变*/
      public static const RESIZE:String = "pkmap.mapresize";
      /**加载开始*/
      public static const LOAD_START:String = "pkmap.maploadstart";
      /**加载结束*/
      public static const LOAD_END:String = "pkmap.maploadend";

      /**
       * MapEvent
       */
      public function MapEvent(type:String, map:Map, bubbles:Boolean = false, cancelable:Boolean = false) {
         this._map = map;
         super(type, bubbles, cancelable);
      }

      override public function clone():Event {
         return this;
      }

      public function get map():Map {
         return this._map;
      }

      public function set map(map:Map):void {
         this._map = map;
      }

      public function get oldZoom():Number {
         return this._oldZoom;
      }

      public function set oldZoom(value:Number):void {
         this._oldZoom = value;
      }

      public function get newZoom():Number {
         return this._newZoom;
      }

      public function set newZoom(value:Number):void {
         this._newZoom = value;
      }

      public function get newCenter():Location {
         return _newCenter;
      }

      public function set newCenter(value:Location):void {
         _newCenter = value;
      }

      public function get oldCenter():Location {
         return _oldCenter;
      }

      public function set oldCenter(value:Location):void {
         _oldCenter = value;
      }

      public function get zoomChanged():Boolean {
         if (this._newZoom != this._oldZoom)
            return true;
         return false;
      }

      public function get centerChanged():Boolean {
         if (this._newCenter != this._oldCenter)
            return true;
         return false;
      }
   }
}

